var zuocedaohuang = document.querySelectorAll("#zuocedaohuang>ul>li>div");
var navpanding=1;
var tuxingbiaodiv5=echarts.init(document.getElementById('div5'));
var tuxingbiaodiv6=echarts.init(document.getElementById('div6'));
var tuxingbiaodiv7=echarts.init(document.getElementById('div7'));
//物联设备
$("#bs-example-navbar-collapse-1 ul:nth-child(3) li:nth-child(2) a").click(function () {
    $("body").load("WuJiaHanWuLianSheBei.html");
})
//主页
$("#zuocedaohuang>ul>li:nth-child(1)").click(function () {
    $("body").load("index.html");
})
//修改密码
$("#zuocedaohuang>ul>li:nth-child(8)>ul>li:first-child").click(function () {
    $("body").load("yaoketongxiugaimm.html");
})
$(".dropdown-menu>li:first-child").click(function () {
    $("body").load("yaoketongxiugaimm.html");
})
//人员管理
$("#zuocedaohuang>ul>li:nth-child(2)>ul>li").click(function () {
    $("body").load("WuJiaHanRenYuanGuanLi.html");
})
//初始化
$("#zuocedaohuang>ul>li:nth-child(8)>ul>li:last-child").click(function () {
    $("body").load("chushihua.html");
})
//主页
$("#bs-example-navbar-collapse-1 ul:nth-child(3) li:nth-child(1) a").click(function () {
    $("body").load("index.html");
})

//物业管理
$("#zuocedaohuang>ul>li:nth-child(5)>ul>li:first-child").click(function () {
    $("body").load("HeLuYiJiaoFeiJiLu.html");
})
//订单管理
$("#zuocedaohuang>ul>li:nth-child(5)>ul>li:nth-child(2)").click(function () {
    $("body").load("HeLuYiDaiJiaoDingDan.html");
})
//收款账号
$("#zuocedaohuang>ul>li:nth-child(5)>ul>li:nth-child(3)").click(function () {
    $("body").load("HeLuYiShouKuanZhangHao.html");
})

//房源管理
$("#zuocedaohuang>ul>li:nth-child(3)>ul>li:first-child").click(function () {
    $("body").load("renchengdongfangyuanhuanli.html");
})
//房屋档案
$("#zuocedaohuang>ul>li:nth-child(3)>ul>li:nth-child(2)").click(function () {
    $("body").load("renchengdongfangwudangan.html");
})

//车位管理
$("#zuocedaohuang>ul>li:nth-child(4)>ul>li:first-child").click(function () {
    $("body").load("cx-chewguanli.html");
})
//车辆管理
$("#zuocedaohuang>ul>li:nth-child(4)>ul>li:nth-child(2)").click(function () {
    $("body").load("cx-chelguanli.html");
})

//工单配置
$("#zuocedaohuang>ul>li:nth-child(6)>ul>li:first-child").click(function () {
    $("body").load("第一个页面.html");
})
//报修管理
$("#zuocedaohuang>ul>li:nth-child(6)>ul>li:nth-child(2)").click(function () {
    $("body").load("第二个页面.html");
})
//物业信息
$("#zuocedaohuang>ul>li:nth-child(7)>ul>li:nth-child(3)").click(function () {
    $("body").load("YaoKeTongWuYeXingXi.html");
})
//信息服务
$("#zuocedaohuang>ul>li:nth-child(7)>ul>li:first-child").click(function () {
    $("body").load("LiuXueQiXinXiFuWu.html");
})
//账单配置
$("#zuocedaohuang>ul>li:nth-child(7)>ul>li:nth-child(2)").click(function () {
    $("body").load("LiuXueQiZhangDanPeiZhi.html");
})

$(".dropdown-toggle").click(function () {
    if (navpanding==1){
        $(".dropdown-menu").css("display","block");
        $(".dropdown-toggle").css("background-color","rgb(221,221,221)")
        navpanding=2;
    }else {
        $(".dropdown-menu").css("display","none");
        $(".dropdown-toggle").css("background-color","rgb(65,92,133)")
        navpanding=1;
    }
})

for(var i = 0 ;i<zuocedaohuang.length;i++){
    zuocedaohuang[i].onclick=function () {
        var liClick = this.parentNode;
        var haizi=liClick.querySelectorAll("ul>li");
        var liHeight = liClick.style.height;
        for(var n = 1 ;n<zuocedaohuang.length;n++){
            var fa=[];
            fa[n]= zuocedaohuang[n].parentNode;
            fa[n].style.height="50px";
            fa[n].style.transition="all 0.2s";
            zuocedaohuang[n].style.color="black";
            zuocedaohuang[n].querySelector("span").style.transform="rotatez(0deg)";
        }
        if(liHeight=="50px"){
            if(haizi&&haizi.length>0){
                this.style.color="black";
                liClick.style.height=50+haizi.length*50+"px";
                this.querySelector("span").style.transform="rotatez(180deg)";
                liClick.style.transition="all 0.2s";
            }
        }else {
            this.style.color="black";
            liClick.style.height="50px";
            // this.querySelector("span").style.transform="rotatez(0deg)";
            liClick.style.transition="all 0.2s";
            this.querySelector("span").style.transform="rotatez(0deg)";
        }
    }
}
$(window).scroll(function () {
    var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
    var i=scrollTop;
    if (scrollTop>500){
        $("#zuocedaohuang>ul").css("margin-top",scrollTop+"px");
    }
    if (scrollTop<500){
        $("#zuocedaohuang>ul").css("margin-top","0")
    }
})





var option = {
    title: {
        text: '设备中心           数据更新时间：2021/06/05  23:30:05'
    },
    tooltip: {},
    legend: {
        data:['在线']
    },
    xAxis: {
        data: ["围墙门禁","单元门禁","智能控梯","车辆道间","车位监控",,,,]
    },
    yAxis: {},
    series: [{
        name: '在线',
        type: 'bar',
        data: [8, 35, 25, 2, 3]
    }]
};

// 使用刚指定的配置项和数据显示图表。
tuxingbiaodiv5.setOption(option);

var option1 = {
    title: {

        text:"智能任行           数据更新时间：2021/06/05  23:30:05\n" +
            "当日开门次数:1500                当日开门人数:1000                住户人流量：784                访客流量：104 \n\n"

    },
    tooltip: {},
    legend: {
        data:['开门数']
    },
    xAxis: {
        data: ["1:00","2:00","3:00","4:00","5:00","6:00","7:00","8:00","9:00","10:00","11:00","12:00"]
    },
    lineStyle: {
        color: 'blue',

    },

    yAxis: {

    },
    series: [{
        name: '开门数',
        type: 'line',
        data: [10, 30, 20, 40, 15,12,60,46,75,30,20,70]
    }]
};

tuxingbiaodiv6.setOption(option1);

// 指定图表的配置项和数据
var option2 = {
    title: {
        text: '智慧车行           数据更新时间：2021/06/05  10:30:05'
    },
    tooltip: {
        trigger: 'axis'
    },
    legend: {
        data:['住户车辆','访客车辆'],
    },
    grid: {
        left: '3%',
        right: '4%',
        bottom: '3%',
        containLabel: true
    },
    toolbox: {
        feature: {
            saveAsImage: {}
        }
    },
    xAxis: {
        type: 'category',
        boundaryGap: false,
        data: ["1:00","2:00","3:00","4:00","5:00","6:00","7:00","8:00","9:00","10:00","11:00","12:00"]
    },
    yAxis: {
        type: 'value'
    },
    series: [
        {
            name:'住户车辆',
            type:'line',
            stack: '总量',
            data:[10, 30, 20, 40, 15,12,60,46,75,30,20,70]
        },
        {
            name:'访客车辆',
            type:'line',
            stack: '总量',
            data:[1, 3, 2, 4, 5,12,6,44,5,30,20,7]
        },

    ]
};

tuxingbiaodiv7.setOption(option2);

